<template>
	<view class="">
		<uni-steps :options="getFlows" direction="column" :active="active"></uni-steps>
	</view>
</template>

<script>
	import {
		mapState
	} from 'pinia';
	import {
		useLoginUserStore
	} from '@/stores/login-user.js';
	export default{
		data(){
			return{
				steps:[],
				active:0,
				fileId:'',
				busCode:''
			}
		},
		computed:{
			...mapState(useLoginUserStore, ['orgId']),
			getFlows(){
				let _that = this;
				let flows = [];
				this.steps.forEach(function(v, i) {
					let o = {
						title: v.flowNodeDesc,
						descList: [ v.name, v.fileStatus || '', v.endTime?v.endTime:'' +(v.allTime ? ' 用时'+v.allTime : '') || '', v.contents || '']
					};
					if (v.endTime) {
						_that.active = i;
					}
					flows.push(o);
				});
				return flows;
			}			
		},
		methods:{
			loadFlow() {
				let _that = this;
				_that.om.request('common/getflow', {
						dvid: _that.fileId,
						formcode: _that.busCode,
						orgId: _that.orgId
					}).then(res => {
						_that.steps = res.value.rows;
					}
				);
			},
		},
		onLoad(options){
			let _that = this
			_that.fileId = options.fileId
			_that.busCode = options.busCode
			_that.loadFlow()
		}
	}
</script>

<style scope>
</style>                                                  
